package service

import (
	"encoding/json"
	flow "ez/apps/flow/document"
	"gitee.com/dreamwood/ez-go/ez"
	"gitee.com/dreamwood/ez-go/ss"
)

func GetFlowById(id int64) []ss.M {
	flowCurd := flow.NewFlowCrud()
	flow, err := flowCurd.FindId(id)
	if err != nil {
		return nil
	}
	tmp, e := json.Marshal(flow.Points)
	if e != nil {
		ez.LogToConsole(e.Error())
		return nil
	}
	re := make([]ss.M, 0)
	e = json.Unmarshal(tmp, &re)
	if e != nil {
		ez.LogToConsole(e.Error())
		return nil
	}
	return re
}
